#pragma once

#include "export.h"
#include <osg/vec3d>
#include <osg/vec4d> //colors
#include <osg/vec4> //colors
#include <string>
#include <sstream>

//----------------------------------------------------------------------
class DENG_EXPORT Vec //: public osg::Referenced
//----------------------------------------------------------------------
{
public:
  Vec(void)                             {x=y=z=0; alpha=1;};
  Vec(double vx, double vy, double vz ) {x=vx; y=vy; z=vz; alpha=1;};
  Vec(double r, double g, double b, double a) {x=r; y=g; z=b; alpha=a;};

  std::string Repr() {std::ostringstream os; os << "(" << x <<", " << y <<", " << z <<")"; return os.str();};
  double x,y,z,alpha;

  Vec Mul(double m) {return Vec(x*m, y*m, z*m, alpha*m);}; 
  Vec Mul(Vec v)    {return Vec(x*v.x, y*v.y, z*v.z, alpha*v.alpha);}; 
  Vec Sum(Vec v)    {return Vec(x+v.x, y+v.y, z+v.z, alpha+v.alpha);}; 

#ifndef SWIG
  Vec(osg::Vec3d *v)             {x=v->x(); y=v->y(); z=v->z();};
  Vec(osg::Vec3d  v)             {x=v.x(); y=v.y(); z=v.z();};
  Vec(osg::Vec4   v)             {x=v.x(); y=v.y(); z=v.z(); alpha=v.a();};
  void operator =(Vec v)         {x=v.x; y=v.y; z=v.z; };
  void operator =(osg::Vec3d *v) {x=v->x(); y=v->y(); z=v->z();};
  void operator =(osg::Vec3d  v) {x=v.x(); y=v.y(); z=v.z();};
  void operator =(const osg::Vec4 v) {x=v.x(); y=v.y(); z=v.z();alpha=v.a();}; // conversion from color
  osg::Vec3d Get()               {return osg::Vec3d(x,y,z);};
  osg::Vec4d GetCol()            {return osg::Vec4d(x,y,z,alpha);};// conversion to color 
#endif

protected:
};
